package com.hanson.basicknowledge.AOPdemo;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

/**
 * @author Hanson
 * @date 2023/2/24 11:34
 */
@Component
@Aspect
public class LoggingAspect {

    @Before("execution(* com.hanson.basicknowledge.AOPdemo.service.UserService.*(..))")
    public void beforeAdvice(JoinPoint joinPoint){
        System.out.println("============================================Before execution method: "+joinPoint.getSignature());
    }

    @After("execution(* com.hanson.basicknowledge.AOPdemo.service.UserService.*(..))")
    public void afterAdvice(JoinPoint joinPoint){
        System.out.println("============================================After execution method: "+joinPoint.getSignature());
    }
}
